IF NOT EXISTS(SELECT * FROM sys.objects WHERE name = 'TB_MODELO')  

CREATE TABLE [dbo].[TB_MODELO](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[DESCRICAO] [varchar](100) NOT NULL,
	[ID_FABRICANTE] [int] NULL,
 CONSTRAINT [PK_TB_MODELO] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[TB_MODELO]  WITH CHECK ADD  CONSTRAINT [FK_TB_MODELO_TB_FABRICANTE] FOREIGN KEY([ID_FABRICANTE])
REFERENCES [dbo].[TB_FABRICANTE] ([ID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO

ALTER TABLE [dbo].[TB_MODELO] CHECK CONSTRAINT [FK_TB_MODELO_TB_FABRICANTE]
GO



